package my.steps;

public class FindSpeed0To1Steps {
    /**
     * 需要每次返回从速度0变到1时的步数
     * 等于1时只赋值一次
     * @param speedStep
     * @return
     */
    private SpeedStep tempStep = null;
    public int findSpeed0To1Steps(SpeedStep speedStep) {
        if (speedStep.speed > 0 && tempStep == null) {
            tempStep = speedStep;
        }
        if (speedStep.speed == 0) {
            tempStep = null;
        }
        if (tempStep != null) {
            return tempStep.step;
        }
        return 0;
    }
}
